package com.bwie.system.controller;

import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import com.bwie.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/User")
public class UserController {
    @Autowired
    UserService userService;

    /**
     * 根据用户名查询用户
     * @param userName
     * @return
     */
    @PostMapping("/findByName/{userName}")
    public Result<User> findByName(@PathVariable String userName){
        Result<User> result=userService.findByName(userName);
        return result;
    }

    /**
     * 我的账户
     * @return
     */
    @GetMapping("/findByUser")
    public Result<List<User>> findByUser(){
        Result<List<User>> result=userService.findByUser();
        return result;
    }
}
